Skip to content

feat(theme): 上架社区动态壁纸交互主题 yfl520.theme.wallpaper-studio v1.1.0 - #5

Merged
Dnyo666 merged 2 commits into
reims-go:mainfrom
yfl520:feat/add-wallpaper-studio-theme
Dec 2, 2026
Merged

Dnyo666 merged 2 commits into
reims-go:mainfrom
yfl520:feat/add-wallpaper-studio-theme

Conversation

@yfl520

@yfl520 yfl520 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

变更类型 / Submission Type

  • 新插件上架 / New plugin
  • 插件版本更新 / Version update
  • 插件软撤回 / Soft withdrawal (withdrawn.json)

插件信息 / Plugin Info

功能简介

  • 本机壁纸库(图片 / GIF / MP4 / WebM):点击状态栏右侧「壁纸工坊」导入本机图片或视频壁纸;元数据与缩略图、媒体文件在 IndexedDB 中分库保存,只在显示时按 id 读取当前壁纸。
  • 虚拟机运行时自动暂停:监听 sdk.subscribeState、vm.stateChanged 与 visibilitychange,任意虚拟机处于 starting / running / resuming / stopping / suspending 或窗口隐藏、减少动态效果时暂停视频。
  • 外观调节与轮播:--theme-card-alpha / --theme-scrim-alpha 直接驱动 --surface-1 / --surface-sidebar / --surface-chrome / --surface-statusbar,所有页面同步生效;定时轮播、内置原创矢量昼夜双景与 6 套配色,支持 prefers-reduced-transparency。
  • 安全与资源释放:无外网请求、无原生程序;浮层仅在打开时挂载,计时器、Blob URL、视频解码与监听器均在停用时释放,宿主托管的 SDK 资源不重复释放。

自检清单 / Checklist

  • 已在本地通过 reims-go plugin doctor ./dir 零硬拦截(基于 Reims-Go 主线 dae9f06)
  • Release 产物由公开 CI 构建,SHA-256:f2af730f8701964e3becbdf826cba112b9b38f76f146b02ca00cf0db82a0000d;本地 scripts/build-index.mjs --check 通过
  • 不包含任何 Apple 专有文件、OSK、真实 SMBIOS 序列号或闭源固件
  • (仅 L3 / ui:script)源码仓库公开且 Release 产物由公开 CI 工作流(.github/workflows/release.yml)从源码构建

@Dnyo666

Dnyo666 commented Dec 2, 2026

Copy link
Copy Markdown
Member

感谢贡献市场首个社区交互式动态壁纸主题!已完整核对本 PR 的 registry.json 变更、Release 产物 v1.0.1(SHA-256 校验通过、CI 构建与仓库源码 pkg/ 一致)、studio.js / theme.css / plugin.json 全量代码以及内嵌图片资源:未发现外网调用、innerHTML、Wails 全局桥接访问或 Apple 专有文件,方向很有价值。

对照 Reims-Go 最新主线(f8cabb4 / v0.2.11)及项目规范完成实测后,发现以下阻塞项与改进建议,请调整后发新版本更新本 PR:


1. 合并前必改(阻塞项)

  1. 移除 plugin.json 中的 "platforms": ["any"](否则市场中全版本客户端均无法安装)

    • build-index.mjs 会将 plugin.json 的 platforms 原样写入 dist/index.json。
    • 当前已发布的 v0.2.11 与最新主线中,CheckMarketCompatibility 仅匹配 windows/amd64 和 *,不识别 any;实测返回:
      platform windows/amd64 not supported (requires any),导致市场按钮置灰「不兼容」且 CLI 拒绝安装。
    • 宿主侧平台校验分叉已在 [Bug]: 插件市场平台兼容校验、外部主题重启/升级丢失及 ui:script 高危审批缺口 Nwflower/Reims-Go#93 跟进修复;但为了兼容已发布的 v0.2.11 客户端,插件侧请直接省略 platforms 字段或改为 ["*"](与已上架插件一致),重新发版并更新本 PR 的 version / asset / sha256。
  2. 修复隐藏的 role="dialog" 浮层阻断全局快捷键

    • studio.js:391-394, 588 在启动时即将带 role="dialog" 的 .rg-ws-popover 插入 document.body,关闭时仅用 CSS display: none 隐藏。
    • Reims-Go 主窗口快捷键守卫会检测 document.querySelector('[role="dialog"], [role="alertdialog"]'),导致启用本主题后,即使浮层处于关闭状态,Ctrl+N / Ctrl+B / Ctrl+L / Ctrl+, / Ctrl+Enter 全部失效。
    • 建议仅在浮层打开时挂载 popover(或在关闭时移除 role="dialog")。

2. 建议一并修复的功能、性能与交互问题

  1. 优化 IndexedDB 视频内存占用与导入错误处理(studio.js:83-94, 736-777, 804)

    • 目前启动时 dbGetAll(db) 会把壁纸库里所有记录连同完整视频 Blob 一次性载入 items 常驻内存(Wallpaper Engine 视频常达数十至数百 MB)。建议拆分为轻量元数据+缩略图 store 与按需按 id 读取的 blob store;缩略图缺失时也避免直接用原图 blob 填满画廊网格。
    • fileInput.onchange 中 !db 时静默无反馈,导入异常(如配额超限/解码失败)被空 catch {} 吞掉且会跳过前面已成功项的激活与刷新;建议补充界面错误提示,并在异步 await 后增加 if (disposed) return 守卫防止停用中途泄漏 thumbURLs。
  2. 「侧栏与卡片不透明度」滑块未覆盖主视图 .list 卡片(theme.css:46-57)

    • 目前仅对 .rg-p-sidebar、.rg-p-card、.rg-p-vm-summary 写了硬编码 rgba(..., var(--ws-card-alpha)),但 VM 页、插件页、设置页等绝大多数分组容器是 .list 和 .theme-hero-card(使用 var(--surface-1),不挂 .rg-p-card),拖动滑块时它们完全不变。
    • 建议改用 UI 契约允许的 --theme-* 前缀自定义变量(如 --theme-card-alpha、--theme-scrim-alpha),在 :root 中直接驱动 --surface-1 / --surface-sidebar / --surface-chrome / --surface-statusbar,可一处生效、消除 plugin.json 与 theme.css 的重复色值,并减少 plugin doctor --contract 提示。
  3. 消除 layer.background 图层 DOM 顺序竞态(theme.css:91)

    • .rg-ws-stage 与宿主 ThemeDecorations 渲染的 .rg-decoration 均挂载在同一 .rg-layer-background 且无 z-index,明暗切换或重渲染若使 .rg-decoration 排在后面,内置静态背景会直接盖住自定义壁纸/视频。给 .rg-ws-stage 加上 z-index: 1 即可。
  4. 浮层层级与定位适配(theme.css:165-186)

    • z-index: 60 高于应用模态遮罩(40)、对话框(41)和菜单(50),会盖在设置/确认弹窗之上,建议降至 35 以下。
    • 写死 bottom: 42px 在展开底部日志抽屉(Ctrl+L)时会直接遮挡日志并与状态栏触发按钮脱节;写死 right: 14px 在 RTL 语种(如 ar-SA)下会与按钮分处窗口两端。建议改用 inset-inline-end 并根据触发按钮位置动态计算 bottom。
  5. 动态语言切换、视频释放与清理入口

    • 触发按钮与浮层内所有文案仅在初始化时求值一次,在应用内切换语言(如 zh-CN ↔ en-US)后不会更新;建议在 sdk.subscribeState 检测到 locale 变化时同步刷新文案。
    • dispose() 卸载时建议先对当前播放中的 activeVideoEl 调用 pause() / removeAttribute('src') / load(),避免软件解码短暂残留。
    • isAnyVMRunning(studio.js:223-232)建议同时覆盖 starting 与 resuming 状态。
    • 由于壁纸存放在 WebView2 IndexedDB 中,客户端卸载插件(含 --purge)不会自动清理这些视频文件,建议在工坊面板提供「清空壁纸库」按钮(并在软件解码模式下对超大视频给出友好提示)。

3. 规范一致性、代码精简与合规建议

  1. 对照 docs/design-guidelines.md 的 UI / 无障碍 / 文案规范

    • 定时轮播目前使用系统原生 <select>(studio.js:521),在暗色模式下与客户端自绘控件风格割裂,建议改为自定义选项列表或分段按钮。
    • 补齐无障碍与点击热区:关闭按钮 ×(26px)缺 aria-label 与 title;删除按钮 × 仅 18×18 px、仅 :hover 显示(键盘无法操作)且 <button> 嵌套在 <div role="button"> 内违反 ARIA 规范;2 个滑块缺 aria-label,触发胶囊缺 aria-expanded / aria-haspopup="dialog"。
    • 面向用户的文案(plugin.json 描述与弹窗提示)建议去掉 ui:script、IndexedDB 等开发者术语,短提示末尾不加句号,英文统一采用 Sentence case(如 Backdrop dimming、Card opacity、Auto slideshow),并适配 @media (prefers-reduced-transparency: reduce)。
  2. 可精简逻辑与冗余代码

    • prefs.randomRotate(studio.js:17, 41, 337-339)无任何 UI 开关,属于死代码,可移除或补齐开关。
    • theme.css:7-8 与 12-14 重复定义 .rg-p-main { background };studio.js 把 sdk.mountLayer / mountSlot / observePart / subscribeState / on 再次包进 dispose(),而 UI SDK 本身已自动释放,实测会重复执行两次;另建议清理 7 处空 catch {}。
  3. 开源合规与 CI

    • 插件仓库 LICENSE 目前只有 17 行声明头,建议补全 Apache-2.0 完整许可证正文。
    • 请在 README / NOTICE 注明 assets/bg-day.jpg、assets/bg-night.jpg 的来源与授权情况,确认可按 Apache-2.0 分发。
    • .github/workflows/release.yml 中的 go-version: '1.24' 建议改为跟随 Reims-Go/go.mod 自动推导(主线已升级至 Go 1.26.0)。

备注:本次评审中同步排查出的 Reims-Go 宿主侧问题(市场平台校验、重启/升级丢失激活主题、theme.uiScript 哈希追踪与高危审批弹窗完善等)已提交至 Nwflower/Reims-Go#93 跟进。待插件侧修复上述问题、发版更新本 PR 并通过 PR Plugin Gate CI 检查后即可再次复核。

@Dnyo666

Dnyo666 commented Dec 2, 2026

Copy link
Copy Markdown
Member

@yfl520 跟进一下宿主侧进展:此前排查出的 Reims-Go 宿主侧问题(Nwflower/Reims-Go#93 )已通过 Nwflower/Reims-Go#98 修复并合入主线 main,现在可以直接基于最新主线 Reims-Go 来修复、调试和验证插件了。

本次宿主主线已就绪的相关能力与改动摘要:

  • 平台与引擎兼容校验统一:市场与安装端现统一支持 platforms 中的 any、*、windows-x64、windows/amd64(如果希望兼容已发布的 v0.2.11 客户端,仍建议省略 platforms 或改为 ["*"];若只面向后续新版客户端则可按需调整 engines.reims-go)。
  • 外部主题生命周期与脚本热重载:重启客户端与原地升级后外部主题会自动保留;contributes.themes[].uiScript 已纳入入口 SHA-256 锚定(升级改动脚本后会提示用户重新核对确认),且 UIScriptURL 会自动带版本哈希参数刷新缓存;reducedMotion 变更也会实时通知交互主题 SDK。
  • 契约检查与快捷键:plugin doctor --contract 已过滤 CSS 注释、url(...) 和字符串字面量不再误报注释里的 .background / .js;主窗口快捷键与菜单焦点恢复也已改为检测可见对话框(不过为了兼容旧版客户端及无障碍语义,浮层关闭时仍建议不要保留隐藏的 role="dialog")。
  • 参考文档同步:插件系统规范与上架约定也在同步更新中(docs(plugin): sync plugin-architecture with market security, theme persistence, and ui:script approval Nwflower/Reims-Go#100 、docs: sync plugin submission guide with host compatibility and ui:script approval rules #7 )。

可以结合上一条评审意见中的插件侧优化项(如 IndexedDB 视频拆分与错误提示、用 --theme-* 变量覆盖 .list 卡片不透明度、图层与浮层 z-index/定位/RTL、动态切换语言、无障碍与自定义下拉控件、空 catch 清理及许可证/图片素材授权说明等)基于最新 Reims-Go 完成修复和自测,发新版本并更新本 PR 后通知我们即可复核合并。

yfl520 added a commit to yfl520/reims-theme-wallpaper-studio that referenced this pull request Dec 2, 2026
Blocking
- Drop `platforms: ["any"]` so v0.2.11 clients accept the package
- Attach the role="dialog" popover only while open, so the host's global
  shortcut guard (Ctrl+N/B/L/,/Enter) is no longer blocked

Functionality and performance
- Split IndexedDB into `meta` (with thumbnails) and `blobs` stores (DB v2,
  automatic v1 migration); media blobs are read by id only when displayed
- Placeholder tiles instead of decoding full media when a thumbnail is missing
- Surface import errors (unsupported/damaged file, storage quota, library
  unavailable) in the panel; `disposed` guard after every await
- Drive --surface-1/-sidebar/-chrome/-statusbar from --theme-card-alpha so
  `.list`, `.theme-hero-card` and every page follow the opacity slider
- `.rg-ws-stage` z-index 1 above the host decoration image
- Popover z-index 35 (below modal 40 / dialog 41 / menu 50), anchored to the
  trigger with inset-inline-end, follows the log drawer and RTL
- Refresh all copy on locale change; release video (pause/src/load) on
  dispose; treat starting/resuming/stopping/suspending as VM-busy
- Clear library button with destructive confirmation; large/4K video hint

Guidelines and cleanup
- Segmented slideshow control instead of native <select>
- aria-label/title on close, 28px keyboard-reachable delete buttons, no
  nested buttons, labelled sliders, aria-expanded/haspopup on the trigger
- User-facing copy without developer jargon, no trailing periods, English in
  sentence case; prefers-reduced-transparency support
- Remove dead `randomRotate`, duplicate .rg-p-main rule, redundant disposal of
  SDK-managed resources and empty catch blocks

Compliance and CI
- Full Apache-2.0 LICENSE text and NOTICE, shipped in the package
- Replace the JPG backdrops (unclear provenance) with original SVG artwork
  generated by scripts/gen-backgrounds.mjs
- release.yml follows the Go version in Reims-Go go.mod and checks the tag
  matches plugin.json
@yfl520 yfl520 changed the title feat(theme): 上架社区动态壁纸交互主题 yfl520.theme.wallpaper-studio v1.0.1 feat(theme): 上架社区动态壁纸交互主题 yfl520.theme.wallpaper-studio v1.1.0 Dec 2, 2026
@yfl520

yfl520 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

感谢细致的评审!已基于 Reims-Go 最新主线(dae9f06)逐条修复,发布 v1.1.0(公开 CI 构建,SHA-256 f2af730f8701964e3becbdf826cba112b9b38f76f146b02ca00cf0db82a0000d),并已更新本 PR 的 version / asset / sha256。源码改动见 yfl520/reims-theme-wallpaper-studio@86dae69。

1. 阻塞项

  1. platforms:已从 plugin.json 删除,build-index.mjs 生成的 index.json 中不再带该字段,兼容 v0.2.11。
  2. 隐藏的 role="dialog":浮层改为仅在打开时 appendChild 到 document.body,关闭即 remove();关闭状态下 document.querySelector('[role="dialog"]') 为空,旧版与新版快捷键守卫都不受影响。

2. 功能、性能与交互

  1. IndexedDB:数据库升级到 v2,拆分为 meta(元数据 + 缩略图)与 blobs(媒体)两个 store,v1 数据通过游标逐条自动迁移;启动只读 meta,显示时按 id 读取单个 blob。缩略图缺失时显示轻量占位,不再用原图填充网格。导入时逐个文件处理,!db、格式不支持/文件损坏、QuotaExceededError 等都会在面板内提示,成功的文件照常激活;每个 await 后都有 if (disposed) return。
  2. 不透明度覆盖 .list:改为 --theme-card-alpha / --theme-scrim-alpha / --theme-chrome-alpha,在 :root 中直接驱动 --surface-1 / --surface-sidebar / --surface-chrome / --surface-statusbar,.list、.theme-hero-card 等全部跟随;plugin.json 中对应的重复色值已删除,doctor --contract 不再有变量提示。
  3. 图层竞态:.rg-ws-stage 加 z-index: 1。
  4. 浮层层级与定位:z-index: 35;根据触发按钮的 getBoundingClientRect() 动态计算 bottom 与 inset-inline-end,打开期间通过 ResizeObserver 跟随日志抽屉(Ctrl+L)与状态栏变化,dir 变化时重新定位,RTL 下与按钮对齐。
  5. 语言、视频释放与清理入口:subscribeState 检测到 locale 变化时刷新所有文案与 aria-label;dispose 时对所有视频执行 pause() / removeAttribute('src') / load() 并回收 Blob URL;忙碌状态覆盖 starting / resuming(另加 stopping / suspending);面板底部新增「清空壁纸库」(带影响范围的二次确认),导入超大或 4K 视频时提示软件渲染模式下的处理器占用;README 说明卸载不会清理 IndexedDB。

3. 规范、精简与合规

  1. UI / 无障碍 / 文案:定时轮播改为自绘分段控件(role="radiogroup",方向键 / Home / End,支持 RTL);关闭按钮 28×28 并带 aria-label 与 title;删除按钮 28×28 点击热区,悬停或键盘聚焦时显示,与选择按钮为同级元素,不再嵌套;滑块使用 <label for>,并设置 aria-valuetext;触发按钮带 aria-haspopup="dialog" / aria-expanded / aria-controls;打开时焦点移入浮层,Esc 关闭后焦点回到触发按钮。文案去掉 ui:script / IndexedDB 等术语和末尾句号,英文改为 Sentence case,并加入 @media (prefers-reduced-transparency: reduce)。
  2. 精简:删除 randomRotate 和重复的 .rg-p-main 规则;mountLayer / mountSlot / observePart / subscribeState / on 交给 SDK 释放,不再重复包进 dispose();空 catch {} 已全部清理,改为带上下文的 console.warn 或界面提示。
  3. 合规与 CI:LICENSE 补全 Apache-2.0 正文,并新增 NOTICE(两者也随包分发)。原 bg-day.jpg / bg-night.jpg 来源无法确认,已移除,替换为原创矢量背景 bg-day.svg / bg-night.svg,可通过仓库内 scripts/gen-backgrounds.mjs 确定性重新生成,包体从约 1.3 MB 降到约 30 KB。release.yml 改为 checkout Reims-Go 后使用 go-version-file: .reims-go-src/go.mod(本次 CI 为 Go 1.26.0),并校验 tag 与 plugin.json 版本一致。

自测

  • reims-go plugin doctor -contract:零硬拦截,剩余提示仅为插件自有的 .rg-ws-* / .is-* 类名。
  • 本地 node scripts/build-index.mjs --check --reims-bin ...:PASS。
  • 用 Edge(headless)加载宿主 app.css / tokens.css 与按 uiSdk.ts 实现的 SDK 做端到端检查,共 39 项全部通过,覆盖:关闭时无 role="dialog"、v1→v2 迁移、滑块驱动 .list、浮层 z-index 与定位(含 RTL 和日志抽屉)、导入与错误提示、VM starting / running / resuming 时暂停视频、语言切换、删除与清空、停用后 DOM / 变量 / 属性全部清理。

@yfl520
yfl520 marked this pull request as draft December 2, 2026 13:15

@Dnyo666 Dnyo666 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢快速且彻底的 v1.1.0 更新!已完成全面复核与实测:

  • 构建溯源与静态门禁:公开 CI 产物 yfl520.theme.wallpaper-studio-1.1.0.zip(SHA-256 f2af730f8701964e3becbdf826cba112b9b38f76f146b02ca00cf0db82a0000d)与仓库 v1.1.0(86dae69)逐字节一致;PR Plugin Gate 的 Validate registry & run static security gate 与 reims-go plugin doctor -contract ui-contract.json 均零硬拦截通过(Fork PR 末尾自动写评论步骤的 403 为 GitHub 只读 GITHUB_TOKEN 已知限制)。
  • 兼容与端到端验证:已验证 v0.2.11 与最新 main 市场兼容(compatible: true)、v1.0.1 -> v1.1.0 IndexedDB 游标拆迁与脚本哈希重审、.list 卡片不透明度联动、无障碍焦点/热区、实时中英/RTL 切换、二次确认清空及停用零残留释放。

附两处非阻塞的细微优化供后续小版本参考:

  1. 浮层打开期间挂有 role="dialog" 会命中宿主的 hasVisibleDialog() 守卫,导致浮层打开时按 Ctrl+L 被宿主拦截(鼠标点外部则会先关闭浮层),若希望面板打开时仍允许 Ctrl+L 展开日志并实时跟随,后续可考虑改用 role="region" 配合 aria-labelledby。
  2. renderActiveWallpaper() 内 requestAnimationFrame 回调可补上 if (disposed || seq !== renderSeq) return;。

LGTM,合并上架!🎉

@Dnyo666
Dnyo666 marked this pull request as ready for review December 2, 2026 13:31
@Dnyo666
Dnyo666 merged commit 382ab72 into reims-go:main Dec 2, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants